<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>淡入与淡出3</title>
    <style>
        *{
            margin: 0;
            padding:0;
        }
        div{
            width: 100px;
            height: 100px;
            margin: 10px auto 0;
            background: #ff4400;
            display: none;
        }
    </style>
</head>
<body>
<input type="button" value="淡入" id="btn1">
<input type="button" value="淡出" id="btn2">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</body>
</html>
<script src="js/jquery-1.10.1.js"></script>
<script>
    $(function () {
        $("#btn1").click(function () {
            $(".box").fadeIn(2000,function () {
                $(this).next().fadeIn(2000,arguments.callee);
            });
        });
        $("#btn2").click(function () {
            $(".box").fadeOut(2000,function () {
                $(this).next().fadeOut(2000,arguments.callee)
            })
        });
    });
</script>